﻿using Clothes.BLL;
using Clothes.IBLL;
using Clothes.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace YongHu_UI
{
    public partial class form : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CLClassifyIBLL cLClassify = new CLClassifyBLL();
                List<CLClassify> list = cLClassify.select();
                ddl_lei.DataSource = list;
                ddl_lei.DataValueField = "Id";
                ddl_lei.DataTextField = "Category";
                ddl_lei.DataBind();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //var a = Session["aa"];
            CLDressIBLL dressIBLL = new CLDressBLL();
            CLDress dress = new CLDress()
            {
                Avatar = Session["aa"].ToString(),
                Summary = txt_jian.Text,
                TypeId = Convert.ToInt32(ddl_lei.SelectedValue),
                Surplus = Convert.ToInt32(txt_shu.Text),
                Price = Convert.ToInt32(txt_shou.Text),
                Money=Convert.ToInt32(txt_jin.Text)
            };
            if (dressIBLL.CLDressInsert(dress))
            {
                ClientScript.RegisterStartupScript(GetType(),"aa","alert('成功')",true);
            } 
        }
    }
}